package demo;

/**
 * @description:
 * @author: GX
 * @time: 2025/10/28 16:52
 */
public class EnumTest {
    public enum level{
        EASY,
        MEDIUM,
        HARD
    }
    public static void main(String[] args){
        int a = 0;
        //返回枚举对象在枚举类中声明的次序，从 0 开始；
        System.out.println(EnumTest.level.HARD.ordinal());
        //比较枚举对象在枚举类中声明的次序，也就是根据ordinal()返回的值进行比较；
        //这里EASY声明比MEDIUM早，return this.ordinal - o.ordinal;所以是1-0=1
        System.out.println(level.MEDIUM.compareTo(level.EASY));
        level l = level.HARD;
        System.out.println(l.describeConstable());
    }
}
